<template>
  <div class="comp_point-task-item-wrap">
    <div class="df1">
      <div>{{taskName}}</div>
      <div class="fs13 cOrange">+{{points}} 积分</div>
    </div>
    <div v-if="!isWm && !isYht" :class="['btn', {'gray': done}]" @click.stop="clickBtn">{{done ? '已完成' : '去完成'}}</div>
    <div v-else-if="isWm" :class="['btn','wanmin', {'gray': done}]" @click.stop="clickBtn">{{done ? '已完成' : '去完成'}}</div>
    <div v-else-if="isYht" :class="['btn','yanghetang', {'gray': done}]" @click.stop="clickBtn">{{done ? '已完成' : '去完成'}}</div>
    <div ></div>
  </div>
</template>

<style scoped lang="scss" rel="stylesheet/scss">
  .comp_point-task-item-wrap {
    display: flex;
    align-items: center;
    padding: 15px 12px;
    background-color: #ffffff;

    .btn {
      font-size: 14px;
      padding: 4px 11px 5px 11px;
      border-radius: 30px;
      color: #ffffff;
      background-color: $themeColor;
      &.gray {
        background-color: #cccccc;
      }
      //万民
      &.wanmin{
        background-color: #f39700;
      }
      //养和堂
      &.yanghetang{
        background-color: #159547
      }
    }
  }
</style>

<script type="text/babel">
  /**
   * Author: Lily Jiang
   * Create Time: 2019/10/9
   * Description: 积分商城 任务列表
   */

  export default {
    name: "TaskItem",
    components: {},
    props: {
      taskName: {   //  任务名称
        type: String,
      },
      points: {     //  任务积分
        type: Number,
        default: 0
      },
      done: {       //  任务完成状态
        type: [Number, Boolean],
        default: false
      },
      isWm: {    
        type: [Boolean],
      },
      isYht: {    
        type: [Boolean],
      }
    },
    data() {
      return {
        isWm: "",
        isYht: ""
      }
    },
    computed: {
      //  getCompany(){
      //   this.isWm = wx.getStorageSync("isWm");
      //   if(this.isWm=="true"){
      //     return this.isWm=1;
      //   }
      //   return this.isWm=0;
      //   if(this.isYht=="true"){
      //     return this.isYht=1;
      //   }
      //   return this.isYht=0;
      // }
    },
    watch: {},
    methods: {
      clickBtn () {
        if (this.done) {
          return
        }
        this.$emit('clickBtn')
      },
    },
    mounted() {
    },
  }
</script>

